@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

:root {
    --primary-color: #1a73e8;
    --secondary-color: #5f6368;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --border-color: rgba(0, 0, 0, 0.12);
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --danger-color: #d93025;
    --success-color: #1e8e3e;
    --warning-color: #f29900;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--surface-color);
    min-height: 100vh;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
header {
    padding: 16px 24px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

header h1 {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.device-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.device-counter .material-icons {
    font-size: 18px;
}

.session-info {
    display: flex;
    align-items: center;
}

.session-id-card {
    background-color: var(--background-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.session-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.session-label .material-icons {
    font-size: 14px;
}

.session-id-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.session-id-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Filter bar styles */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.filter-primary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.filter-secondary {
    display: none;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 16px;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

.filter-secondary.expanded {
    display: flex;
}

.filter-secondary .filter-group {
    flex-wrap: wrap;
    gap: 16px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 100px;
        transform: translateY(0);
    }
}

.filters-toggle {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-color);
}

.filters-toggle.expanded {
    transform: rotate(0);
    background-color: rgba(26, 115, 232, 0.08);
}

.filters-toggle .material-icons {
    transition: transform 0.3s ease;
}

.filters-toggle.expanded .material-icons {
    transform: rotate(180deg);
}

.toggle-text {
    font-size: 13px;
    color: var(--text-primary);
}

.filter-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--background-color);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    flex: 0 1 300px;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.filter-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.compact-select {
    padding: 8px 28px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-color);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    min-width: 150px;
}

.compact-select[multiple] {
    height: auto;
    min-height: 120px;
    background-image: none;
    padding: 6px 12px;
    width: 100%;
    max-width: 300px;
}

.compact-select[multiple] option {
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
}

.compact-select[multiple] option:checked {
    background-color: rgba(26, 115, 232, 0.1);
    color: var(--primary-color);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* Main content layout */
.main-content {
    display: flex;
    height: calc(100vh - 200px); /* Adjusted height: viewport - header - footer */
    background-color: var(--background-color);
    position: relative;
    overflow: hidden;
    width: 100%;
    flex: 1;
}

/* Sidebar styles */
.sidebar {
    width: 280px;
    min-width: 280px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
}

.sidebar.collapsed {
    width: 72px;
    min-width: 72px;
}

.sidebar.collapsed + .content,
.content.sidebar-collapsed {
    width: calc(100% - 72px);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.device-list {
    padding: 8px;
    overflow-y: auto;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.device-item:hover {
    background-color: var(--background-color);
}

.device-item.active {
    background-color: rgba(26, 115, 232, 0.08);
    color: var(--primary-color);
}

.device-item .material-icons {
    font-size: 20px;
}

.device-icon {
    margin-right: 8px;
}

.device-icon.online {
    color: var(--primary-color); /* 蓝色表示在线 */
}

.device-icon.offline {
    color: var(--text-secondary); /* 灰色表示离线 */
}

.device-count {
    margin-left: auto;
    background-color: var(--background-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

/* Main content area */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    width: calc(100% - 280px);
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: width 0.3s ease;
}

.content::-webkit-scrollbar {
    display: none;
}

/* Filter button styles */
.filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.filter-btn:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.filter-btn .material-icons:last-child {
    transition: transform 0.2s ease;
}

.filter-btn.active .material-icons:last-child {
    transform: rotate(180deg);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--background-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #1557b0;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--background-color);
    border-color: var(--text-secondary);
}

/* Modal checkbox filter styles */
.modal-body .checkbox-filter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body .checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.modal-body .checkbox-item:hover {
    background-color: var(--background-color);
}

.modal-body .checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.modal-body .checkbox-item label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
}

/* Log viewer styles */
.log-viewer {
    background-color: transparent;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    border: none;
    box-shadow: none;
    box-sizing: border-box;
}

/* 右键菜单样式 */
.context-menu {
    position: absolute;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    min-width: 150px;
    display: none;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-item:hover {
    background-color: var(--background-color);
}

.context-menu-item.danger {
    color: var(--danger-color);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.log-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.log-status .material-icons {
    font-size: 12px;
    color: var(--success-color);
}

.log-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    background-color: transparent;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Common components */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn .material-icons {
    font-size: 16px;
}

.icon-btn:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background-color: var(--danger-color);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    opacity: 0.9;
}

.highlight {
    color: var(--primary-color);
    font-weight: 500;
}

/* Footer styles */
footer {
    padding: 6px 24px;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    min-height: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-center .session-id-card {
    padding: 4px 8px;
    min-width: 160px;
    background-color: var(--surface-color);
    border: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    gap: 8px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.footer-center .session-id-card:hover {
    background-color: var(--background-color);
}

.footer-center .session-label {
    font-size: 10px;
    gap: 3px;
    line-height: 1.2;
    flex-shrink: 0;
}

.footer-center .session-label .material-icons {
    font-size: 12px;
}

.footer-center .session-id-value {
    font-size: 12px;
    letter-spacing: 0.3px;
}

.footer-center .session-id-content {
    gap: 4px;
    line-height: 1.2;
    flex: 1;
    justify-content: flex-end;
}

.footer-right {
    display: flex;
    align-items: center;
}

.device-stats {
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 4px 0;
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.device-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.device-stats .material-icons {
    font-size: 16px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .filter-primary {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .search-box {
        flex: 1 1 250px;
        min-width: 200px;
    }
    
    .filter-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .filters-toggle {
        order: 1;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 140px; /* Account for header height */
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
        min-width: 280px;
        width: 280px;
    }
    
    .sidebar.expanded {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content,
    .content.sidebar-collapsed,
    .sidebar.collapsed + .content {
        padding-left: 0;
        width: 100%;
    }
    
    /* Add overlay when sidebar is open */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
}
    


@media (max-width: 768px) {
    .container {
        height: 100vh;
        overflow: hidden;
    }
    
    header {
        padding: 12px 16px;
    }
    
    .header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    header h1 {
        font-size: 18px;
    }
    
    .filter-bar {
        gap: 8px;
    }
    
    .filter-primary {
        flex-direction: row;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-box {
        flex: 1;
        min-width: auto;
        order: 1;
    }
    
    .filter-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 6px;
        width: 100%;
        order: 2;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .filters-toggle {
        align-self: center;
        order: 3;
    }
    
    .filter-secondary {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .filter-secondary .filter-group {
        order: 1;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        order: 2;
    }
    
    .compact-select {
        width: 100%;
        min-width: 120px;
    }
    
    .icon-btn {
        padding: 8px;
        min-width: 40px;
    }
    
    .btn-danger {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .main-content {
        height: calc(100vh - 180px); /* Adjusted for mobile header height */
    }
    
    .sidebar {
        top: 180px; /* Adjusted for expanded header */
        width: 100%;
        max-width: 300px;
    }
    
    .log-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .log-status {
        font-size: 14px;
    }
    
    .log-actions {
        gap: 6px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        padding: 8px 0;
    }
    
    .footer-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .stats {
        font-size: 14px;
    }
    
    .device-stats {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .stat-item {
        flex-direction: row;
        gap: 6px;
    }
    
    .footer-center {
        width: 100%;
        justify-content: center;
    }
    
    .footer-center .session-id-card {
        min-width: auto;
        width: 100%;
        max-width: none;
        padding: 8px 12px;
        flex-direction: column;
        gap: 6px;
        align-items: flex-start;
    }
    
    .footer-center .session-id-content {
        width: 100%;
        justify-content: space-between;
    }
    
    .footer-center .session-label {
        font-size: 12px;
    }
    
    .footer-center .session-id-value {
        font-size: 12px;
        letter-spacing: 0.2px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 8px 12px;
    }
    
    .header-main {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    header h1 {
        font-size: 16px;
    }
    
    .connection-status {
        font-size: 12px;
    }
    
    .filter-bar {
        gap: 6px;
    }
    
    .filter-primary {
        gap: 8px;
    }
    
    .search-box {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .filter-group {
        gap: 6px;
    }
    
    /* 在最小屏幕上的checkbox横向布局优化 */
    .checkbox-filter {
        gap: 4px !important;
        padding: 3px 4px !important;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .checkbox-item {
        padding: 2px 4px !important;
        gap: 2px !important;
        font-size: 10px !important;
        min-width: auto;
    }
    
    .checkbox-item label {
        font-size: 10px !important;
        line-height: 1.1;
    }
    
    .compact-select {
        padding: 6px 20px 6px 10px;
        font-size: 14px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn-danger {
        width: 100%;
        justify-content: center;
    }
    
    .main-content {
        height: calc(100vh - 200px); /* Adjusted for smaller mobile header */
    }
    
    .sidebar {
        top: 200px;
    }
    
    .log-content {
        font-size: 12px;
        line-height: 1.4;
    }
    
    footer {
        padding: 6px 12px;
    }
    
    .footer-content {
        gap: 8px;
    }
    
    .stats {
        font-size: 12px;
    }
    
    .device-stats {
        gap: 6px;
    }
    
    .footer-center .session-id-card {
        padding: 6px 10px;
    }
    
    .footer-center .session-label {
        font-size: 11px;
    }
    
    .footer-center .session-id-value {
        font-size: 11px;
    }
}

/* 会话 metric 卡片样式 */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.session-metric {
    display: flex;
    align-items: center;
    gap: 10px;

.chip-value-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    border: none;
    background: transparent;
    padding: 6px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s, transform 0.12s;
}

.copy-btn:hover {
    background: rgba(37,99,235,0.08);
    transform: translateY(-1px);
}

/* 简单 toast 提示 */
.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1200;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
    padding: 10px;
    background: linear-gradient(180deg,#ffffff,#fbfdff);
    border: 1px solid rgba(16,24,40,0.04);
    border-radius: 10px;
    box-shadow: 0 6px 12px rgba(16,24,40,0.04);
}

.metric-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#eef2ff,#e0f0ff);
    border-radius: 8px;
}

.metric-body .metric-label {
    font-size: 12px;
    color: #6b7280;
}

.metric-value {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.metric-value.mono {
    font-family: 'Courier New', monospace;
}

.metric-value.badge {
    background: linear-gradient(90deg,#fff7ed,#fff1d6);
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.04);
    color: #92400e;
}

@media (max-width: 700px) {
    .metric-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .metric-chip {
        padding: 6px 10px;
        gap: 8px;
    }
    
    .chip-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .chip-body .chip-label {
        font-size: 11px;
    }
    
    .chip-value {
        font-size: 13px;
    }
}

/* 卡片通用样式 */
.card {
    background: linear-gradient(180deg,#ffffff,#fbfdff);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(16,24,40,0.04);
    overflow: hidden;
}

.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.card-body {
    padding: 12px 16px;
}

.session-card .session-details span {
    display: block;
    margin-bottom: 8px;
}

/* 放在 header 下方的紧凑会话指标栏 */
.session-metrics-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    margin-top: 8px;
}

.metric-chip {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(180deg,#ffffff,#fbfdff);
    border-radius: 12px;
    border: 1px solid rgba(16,24,40,0.04);
    box-shadow: 0 6px 14px rgba(16,24,40,0.03);
}

.chip-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(135deg,#eef2ff,#e0f0ff);
    font-size: 18px;
}

.chip-body .chip-label {
    font-size: 12px;
    color: #6b7280;
}

.chip-value {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.session-card .card-body {
    padding-top: 6px; /* 减小顶部间距，因为 metrics 已经移到 header */
}

@media (max-width: 700px) {
    .session-metrics-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .metric-chip {
        justify-content: space-between;
        padding: 8px 12px;
    }
    
    .chip-icon {
        width: 28px;
        height: 28px;
    }
}

.logs-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 调整 log-container 在卡片内的高度，使其独立滚动 */
#log-container {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    background-color: white;
    border: none;
    box-shadow: none;
}

/* Enhanced narrow screen layout */
@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .sidebar {
        height: auto;
        order: -1;
        position: relative;
        width: 100%;
        transform: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar.collapsed {
        height: 60px;
        overflow: hidden;
    }
    
    #log-container {
        max-height: none;
        height: calc(100vh - 350px);
    }
    
    .main-content {
        flex-direction: column;
    }
}

/* Header controls layout: wrap and align neatly on narrow screens */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.clear-logs-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Improved button spacing and sizing */
.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .controls {
        gap: 8px;
    }
    
    .filter-group {
        min-width: auto;
        width: 100%;
    }
    
    .clear-logs-group {
        width: 100%;
        justify-content: center;
    }
}

/* Log container: fixed inner scroll area so header/footer stay visible */
#log-container {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0;
    background: rgba(255,255,255,0.6);
    border-radius: 0;
    border: none;
}

/* Ensure session-info shows when content exists and doesn't push layout unexpectedly */
.session-info {
    display: block;
    width: 100%;
}

.device-tab {
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid #dee2e6;
    background-color: transparent;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    text-align: left;
    white-space: nowrap;
    width: 100%;
    font-size: 14px;
}

.device-tab:hover {
    background-color: #e9ecef;
}

.device-tab.active {
    background-color: #3498db;
    color: white;
    border-left: 4px solid #2980b9;
}

/* 设备选择高亮样式 */
.device-item.selected {
    background-color: #3498db;
    color: white;
    border-left: 4px solid #2980b9;
}

.device-item.selected .device-status-icon {
    color: white;
}

.device-item.selected:hover {
    background-color: #2980b9;
}

/* Enhanced tablet and mobile responsiveness */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
        flex: 1;
    }
    
    .device-tabs {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        max-height: 150px;
        order: -1; /* Move to top */
    }
    
    .tab-container {
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: thin;
    }
    
    .device-tab {
        min-width: 100px;
        text-align: center;
        border-bottom: none;
        border-right: 1px solid #dee2e6;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .device-tab.active {
        border-left: none;
        border-bottom: 4px solid #2980b9;
    }

    /* Make header controls wrap better on small screens */
    .controls {
        justify-content: space-between;
        gap: 8px;
        flex-direction: column;
    }
}



.device-tab.has-new-logs::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background-color: #e74c3c;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.device-status {
    font-size: 14px;
    color: #666;
}

/* 设备状态图标样式已移除，使用设备图标颜色表示状态 */

/* 会话信息样式 */
.session-info {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 0;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    display: block;
}

.current-session h3,
.session-history h3 {
    margin-bottom: 16px;
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-session h3::before {
    content: '📊';
    font-size: 20px;
}

.session-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.session-details span {
    background: rgba(59, 130, 246, 0.1);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: #475569;
    border-left: 4px solid #3b82f6;
    transition: all 0.2s ease;
}

.session-details span:hover {
    background: rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.session-details span span {
    font-weight: 600;
    color: #1e293b;
    display: block;
    margin-top: 4px;
}


    
    .session-details {
        flex-direction: column;
        gap: 8px;
        grid-template-columns: 1fr;
    }
    
    .session-details span {
        font-size: 12px;
        padding: 8px 12px;
        margin-bottom: 0;
    }

.session-history {
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.session-history h3 {
    margin: 0 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
}

.session-history h3::before {
    content: '📚';
    font-size: 20px;
    margin-right: 8px;
}

.toggle-btn {
    padding: 8px 16px;
    font-size: 13px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    font-weight: 500;
}

.toggle-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.history-sessions {
    margin-top: 16px;
    max-height: 320px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.5);
    padding: 8px;
}

.history-sessions.collapsed {
    max-height: 0;
    overflow: hidden;
}

.session-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
}

.session-item:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #2196f3;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.session-item.active {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border-color: #4caf50;
    box-shadow: 0 3px 8px rgba(76,175,80,0.3);
}

.session-item.active::before {
    content: '📋';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    background: #4caf50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 日志状态指示器样式 */
.log-status-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.log-status-indicator.realtime {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2), 0 2px 4px -1px rgba(16, 185, 129, 0.1);
}

.log-status-indicator.history {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.2), 0 2px 4px -1px rgba(245, 158, 11, 0.1);
}

.status-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-icon {
    font-size: 16px;
    animation: pulse 2s infinite;
}

.status-text {
    font-weight: bold;
    font-size: 16px;
    color: #495057;
}

.status-description {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

.status-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.control-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

.btn-icon {
    font-size: 14px;
}

.btn-text {
    font-size: 12px;
}

.log-level-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-filter {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 8px;
    background-color: var(--surface-color);
    border-radius: var(--radius-md);
    width: fit-content; /* Changed from 100% */
    justify-content: flex-start;
}

.checkbox-item {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background-color: var(--background-color);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    margin-right: 0;
    white-space: nowrap;
    flex-shrink: 0;
    flex: 0 0 auto;
}

.checkbox-item:hover {
    background-color: rgba(26, 115, 232, 0.08);
}

.checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-item label {
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    margin: 0;
    line-height: 1.2;
}

.filter-label {
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.level-checkboxes {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 重复的checkbox-item样式已合并到上面的定义中 */

/* 强制横向布局的额外规则 */
.checkbox-filter {
    flex-flow: row wrap !important;
    align-content: flex-start;
}

.checkbox-item {
    order: 0;
    flex-basis: auto;
}

/* 确保在所有情况下都保持横向布局 */
#level-filter.checkbox-filter {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    width: auto !important;
    min-width: 0 !important;
}

#level-filter.checkbox-filter .checkbox-item {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.checkbox-label {
    font-weight: 500;
    user-select: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 会话日志标题样式 */
.session-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
    margin-bottom: 10px;
    border-radius: 5px;
}

.session-logs-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.back-btn {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: #1976d2;
}

.no-logs {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin: 20px 0;
}

.session-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.session-item-header .session-id {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.session-item-details {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.session-item-details .detail-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.session-item-details .detail-item .icon {
    font-size: 10px;
    opacity: 0.7;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.filter-group {
    display: row;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* 清除日志组样式 */
.clear-logs-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.clear-option {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all 0.2s ease;
    user-select: none;
}

.clear-option:hover {
    color: #3b82f6;
}

.clear-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-option input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.clear-option input[type="checkbox"]:hover {
    border-color: #3b82f6;
}

.clear-option span {
    font-weight: 500;
}

/* 次要控件折叠样式 */
.controls-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    max-height: 999px;
    transition: max-height 0.28s ease, opacity 0.2s ease;
    opacity: 1;
}

.controls-secondary:not(.expanded) {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* 更多按钮样式 */
.more-btn {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.08);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #2c3e50;
    font-weight: 600;
    transition: all 0.18s ease;
}

.more-btn:hover {
    background: rgba(0,0,0,0.04);
    transform: translateY(-2px);
}

/* 统一按钮样式 */
.btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    background: linear-gradient(135deg,#ffffff,#f3f6fb);
    cursor: pointer;
    color: #1f2937;
    font-weight: 600;
}

.btn:hover {
    box-shadow: 0 6px 12px rgba(32,33,36,0.06);
    transform: translateY(-2px);
}

/* 会话过滤器样式增强 */
.session-filter-container {
    position: relative;
}

.session-filter-container select {
    padding-right: 30px;
}

.session-filter-container::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #666;
}

/* 会话选项样式 */
.session-filter-container select optgroup {
    font-weight: bold;
    color: #333;
    background: #f5f5f5;
}

.session-filter-container select option.active-session {
    background: #e8f5e8;
    color: #2d5a2d;
}

.session-filter-container select option.historical-session {
    background: #f0f0f0;
    color: #666;
}

@media (max-width: 768px) {
    .controls {
        gap: 10px;
    }
    
    .filter-group {
        flex-direction: row;
        align-items: stretch;
        gap: 5px;
        min-width: 120px;
    }
    
    .filter-group label {
        font-size: 12px;
        font-weight: bold;
    }
}

select, input, button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

button {
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    select, input, button {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    /* 确保checkbox筛选器在移动端保持横向布局 */
    .checkbox-filter {
        gap: 6px !important;
        padding: 4px 6px !important;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .checkbox-filter::-webkit-scrollbar {
        display: none;
    }
    
    .checkbox-item {
        padding: 3px 6px !important;
        gap: 3px !important;
        font-size: 11px !important;
        flex-shrink: 0;
    }
    
    .checkbox-item label {
        font-size: 11px !important;
    }
}

main {
    flex: 1;
    overflow-y: hidden;
    padding: 15px 0;
}

#log-container {
    flex: 1;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 24px;
    overflow-y: auto;
    margin: 0;
    font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    overflow-x: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-height: 400px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}



@media (max-width: 768px) {
    #log-container {
        font-size: 12px;
    }
    
    .log-entry {
        padding: 6px 8px;
        margin-bottom: 3px;
    }
    
    .log-header {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .log-timestamp {
        font-size: 11px;
    }
    
    .log-level {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .log-module {
        font-size: 11px;
        padding: 2px 6px;
    }
}

.log-entry {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 4px;
    position: relative;
    border-left: 4px solid transparent;
}

.log-entry.info {
    background-color: #f8f9fa;
    border-left-color: #17a2b8;
}

.log-entry.warning {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

.log-entry.error {
    background-color: #f8d7da;
    border-left-color: #dc3545;
}

.log-entry.exception {
    background-color: #ffe5e8;
    border-left-color: #e83e8c;
}

.log-entry.emergency {
    background-color: #ffdddd;
    border-left-color: #ff0000;
}

/* 新日志高亮样式 */
.log-entry.new-log {
    background: linear-gradient(90deg, rgba(23, 162, 184, 0.1) 0%, rgba(23, 162, 184, 0.05) 50%, transparent 100%);
    animation: newLogFade 3s ease-out;
    box-shadow: 0 0 8px rgba(23, 162, 184, 0.3);
}

@keyframes newLogFade {
    0% {
        background: rgba(23, 162, 184, 0.2);
        box-shadow: 0 0 12px rgba(23, 162, 184, 0.5);
    }
    100% {
        background: transparent;
        box-shadow: none;
    }
}

.log-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-weight: bold;
}

.log-timestamp {
    color: #6c757d;
    font-size: 12px;
}

.log-level {
    font-weight: bold;
}

.log-level.info {
    color: #17a2b8;
}

.log-level.warning {
    color: #ffc107;
}

.log-level.error {
    color: #dc3545;
}

.log-level.exception {
    color: #e83e8c;
}

.log-level.emergency {
    color: #ff0000;
}

.log-module {
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.log-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.collapsible {
    cursor: pointer;
}

.collapse-indicator {
    display: inline-block;
    width: 20px;
    text-align: center;
    cursor: pointer;
}

.collapsed-count {
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 10px;
    font-size: 12px;
}

footer {
    display: flex;
    justify-content: space-between;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 14px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

#status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #dc3545; /* 红色表示未连接 */
}

#status-indicator.connected {
    background-color: #28a745; /* 绿色表示已连接 */
}

#status-indicator.connecting {
    background-color: #ffc107; /* 黄色表示连接中 */
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* 页脚设备统计样式 */
.device-stats-footer {
    display: flex;
    align-items: center;
}

.device-stats-compact {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6c757d;
    flex-wrap: wrap;
}

.device-stats-compact span {
    white-space: nowrap;
}

.device-stats-compact span span {
    font-weight: 500;
    color: #495057;
}

@media (max-width: 768px) {
    footer {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .device-stats-compact {
        gap: 8px;
        font-size: 11px;
    }
}

/* 按钮状态样式 */
.btn-active {
    background-color: #28a745 !important;
    color: white !important;
    border-color: #1e7e34 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25) !important;
}

.btn-inactive {
    background-color: #6c757d !important;
    color: white !important;
    border-color: #545b62 !important;
    box-shadow: 0 0 0 2px rgba(108, 117, 125, 0.25) !important;
}

.btn-active:hover {
    background-color: #218838 !important;
    border-color: #1e7e34 !important;
    transform: translateY(-1px);
}

.btn-inactive:hover {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
    transform: translateY(-1px);
}

/* 去重模式按钮样式 */
.deduplication-btn {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
    color: #4caf50;
}

.deduplication-btn:hover {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.6);
}

/* 重复日志计数样式 */
.log-repeat-count {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
}

/* 去重日志时间范围样式 */
.log-time-range {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* 分页控件样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.pagination button {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pagination button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
}

.pagination .page-info {
    color: #ffffff;
    font-size: 14px;
    margin: 0 10px;
    opacity: 0.8;
}

/* 历史日志模式指示器 */
.history-mode {
    background: #1a472a;
    border-left: 4px solid #22c55e;
}

.history-mode::before {
    content: "📚 历史日志模式";
    display: block;
    color: #22c55e;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

.history-mode-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* 去重模式指示器 */
.deduplication-indicator {
    position: fixed;
    top: 60px;
    right: 20px;
    background: rgba(76, 175, 80, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* 会话容器样式 */
.session-container {
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.session-container.highlighted-session {
    border: 2px solid #007bff;
    background: #f0f8ff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
}

.session-header {
    background-color: #f8f9fa;
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.session-header:hover {
    background-color: #e9ecef;
}

.session-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.session-toggle {
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
    min-width: 16px;
}

.session-label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.session-device {
    color: #6f42c1;
    font-weight: 500;
    font-size: 12px;
}

.session-count {
    color: #6c757d;
    font-size: 12px;
}

.session-time {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: #6c757d;
}

.session-status {
    color: #28a745;
    font-weight: 500;
}

.session-logs {
    padding: 0;
}

/* 会话内日志条目样式调整 */
.session-container .log-entry {
    margin-bottom: 0;
    border-radius: 0;
    border-bottom: 1px solid #f1f3f4;
}

.session-container .log-entry:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .pagination .page-info {
        font-size: 12px;
        margin: 0 5px;
    }
    
    .history-mode-indicator {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .deduplication-indicator {
        top: 40px;
        right: 10px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .controls button {
        min-width: auto;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .filter-group {
        flex-direction: row;
        align-items: stretch;
    }
    
    .session-header {
        padding: 8px 12px;
    }
    
    .session-title {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .session-time {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group label {
        margin-bottom: 4px;
    }
    
    .session-container {
        margin-bottom: 15px;
    }
    
    .session-header {
        padding: 6px 8px;
    }
    
    .session-label {
        font-size: 12px;
    }
    
    .log-entry {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .log-timestamp {
        font-size: 10px;
    }
    
    .log-level {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .log-module {
        font-size: 10px;
        padding: 1px 4px;
    }
}

/* 表格视图样式 */
.table-view {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.table-view th {
    background: #f8f9fa;
    color: #333;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-view td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    vertical-align: top;
}

.table-view tr:hover {
    background-color: #f7fafc;
}

.table-view tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table-view tr:nth-child(even):hover {
    background-color: #e9ecef;
}

.table-view .timestamp-col {
    width: 140px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #666;
}

.table-view .level-col {
    width: 80px;
    text-align: center;
}

.table-view .module-col {
    width: 100px;
    font-weight: 500;
}

.table-view .device-col {
    width: 100px;
    color: #4a5568;
}

.table-view .session-col {
    width: 120px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #666;
}

.table-view .message-col {
    min-width: 300px;
    word-break: break-word;
    line-height: 1.4;
}

/* 表格中的日志级别样式 */
.table-view .log-level {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-view .log-level.debug {
    background-color: #e2e8f0;
    color: #4a5568;
}

.table-view .log-level.info {
    background-color: #bee3f8;
    color: #2b6cb0;
}

.table-view .log-level.warn {
    background-color: #faf089;
    color: #b7791f;
}

.table-view .log-level.error {
    background-color: #fed7d7;
    color: #c53030;
}

.table-view .log-level.fatal {
    background-color: #feb2b2;
    color: #9b2c2c;
}

/* 日志折叠和重复计数样式 */
.repeat-count {
    display: inline-block;
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.collapse-toggle {
    display: inline-block;
    cursor: pointer;
    color: #666;
    font-size: 12px;
    margin-right: 6px;
    user-select: none;
    transition: color 0.2s ease;
}

.collapse-toggle:hover {
    color: #1976d2;
}

.log-detail-row {
    background-color: #f8f9fa;
    border-left: 3px solid #dee2e6;
}

.log-detail-row .detail-timestamp {
    padding-left: 20px;
    font-size: 11px;
    color: #6c757d;
}

.log-detail-row .detail-message {
    padding-left: 20px;
    font-style: italic;
    color: #495057;
}

/* 响应式表格 */
@media (max-width: 768px) {
    .table-view {
        font-size: 11px;
    }
    
    .table-view th,
    .table-view td {
        padding: 6px 4px;
    }
    
    .table-view .timestamp-col {
        width: 100px;
        font-size: 10px;
    }
    
    .table-view .level-col {
        width: 60px;
    }
    
    .table-view .module-col {
        width: 80px;
    }
    
    .table-view .device-col {
        width: 80px;
    }
    
    .table-view .session-col {
        width: 100px;
        font-size: 10px;
    }
    
    .table-view .message-col {
        min-width: 200px;
    }
    
    .repeat-count {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .collapse-toggle {
        font-size: 10px;
    }
} /* 修复缺失的大括号 */
}
